<template>
  <div>
    <el-tag
      v-if="renderField.prop === 'flag'"
      :type="renderRow.flag ? 'success' : 'info'"
      >{{ state.statusDict[renderField.prop as any][renderRow.flag] }}</el-tag
    >
    <el-tag
      v-if="renderField.prop === 'remoteControl'"
      :type="renderRow.remoteControl ? 'success' : 'info'"
      >{{
        state.statusDict[renderField.prop as any][renderRow.remoteControl]
      }}</el-tag
    >
  </div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, inject } from "vue";
import type { TableColumn, TableRow, OptButton } from "@/utils/baTable"; //表格列行类型

const rule = inject("rule") as any;

// BuildAdmin将自动为此组件传递五个Props
interface Props {
  renderValue: any; // 单元格值
  renderRow: TableRow; // 当前行数据
  renderField: TableColumn; // 当前列数据
}

const props = withDefaults(defineProps<Props>(), {});

const state: { statusDict: any } = reactive({
  statusDict: rule.tags,
});

onMounted(() => {
  // console.log(
  //   "TagVue单元格值",
  //   cabinet.tags,
  //   cabinet.tags[props.renderField.prop as any][props.renderRow.cabinetType],
  //   state.statusDict[props.renderField.prop as any][props.renderRow.cabinetType]
  // );
});
</script>
<style lang="scss" scoped></style>
